package cn.biwysh.exam.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class QLogout extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String pname=request.getParameter("pname");
		String cid=request.getParameter("cid");
		HttpSession session = request.getSession(false);
		session.setAttribute("userqt", null);
		if(pname!=null){
			if(pname.equals("index")){
				  response.sendRedirect("index.do");
				}else if(pname.equals("zsmore")){
				  response.sendRedirect("zsmore.do");
				}else if(pname.equals("zslist")){
				  response.sendRedirect("zslist.do?cid="+cid);
				}else if(pname.equals("tglist")){
				  response.sendRedirect("tglist.do");
				}else{
				  response.sendRedirect("index.do");
				}
		}else{
			response.sendRedirect("index.do");
		}
		
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
